<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no">
    <title>意见反馈</title>
    <link rel="stylesheet" href="__PUBLIC__/Home/css/memberComplain.css">
    <include file="Public/common_js"/>
</head>
<body>
<div class="complain-list"></div>
<div class="progress-loader">
    <a href="javascript:;" class="btn btn-second btn-block">加载更多</a>
    <span class="loading"><i></i>正在加载...</span>
</div>
<script type="text/javascript" src="__PUBLIC__/Home/js/jqScroller.js"></script>
<script type="text/javascript">
/*    function getFormatTime(time){
        if(!time) return "";
        time = time.replace(/[\/-:]/g, " ");
        return time[1]+"月"+time[2]+"日&nbsp;&nbsp;"+time[3]+":"+time[4];
    }*/
    $(".progress-loader a").click(function(){
        $(this).hide();
        $(this).siblings('.loading').css("display", "block");
        jqScroller.block();
        jqScroller.render(jqScroller.curPage);
    });

    jqScroller.render = function(cpage){
        $(".progress-loader a").hide();
        $(".progress-loader .loading").css("display", "block");
        var rs = "";
        var pernum = 10;
        $.ajax({
            url: '{:U("MemberComplain/ajax_lists")}',
            type: 'POST',
            dataType: 'json',
            data:{'page' : cpage},
            success:function(rs){
                if(rs.totalPage <= cpage){
                    jqScroller.done();
                    $(".progress-loader").remove();
                }else{
                    jqScroller.curPage++;
                }
                $(".progress-loader a").show();
                $(".progress-loader .loading").css("display", "none");
                var html = "";
                var list = rs.data;
                var replys = null;
                if(list){
                    for(var i = 0; i < list.length; i++){
                        html += '<div class="one-complain">';
                        html += '<div class="time">'+list[i].time+'</div>';
                        html += '<div class="unifo">';
                        html += '<img src="<?php echo (!empty($user_top_img) ? $user_top_img : "/Public/Home/images/userPic.png"); ?>" /><span class="uname">'+list[i].operation_name+'</span>';
                        html += '</div>';
                        html += '<p class="cptalk">'+list[i].message+'</p>';
                        replys = list[i].replys;
                        if(replys){
                            html += '<i class="arrow"></i>';
                            html += '<div class="replys">';
                            for(var k = 0; k < replys.length; k++){
                                html += '<p class="one-reply">'+replys[k].operation_name+'回复:'+replys[k].message+'</p>';
                            }
                            html += '</div>';
                        }else{
                            html += '<div class="no-reply">暂无回复，请给我们点时间</div>';
                        }
                        html += '</div>';
                    }
                    if(cpage == 1 && cpage % 10 == 0){
                        $(".complain-list").html(html);
                    }else{
                        $(".complain-list").append(html);
                    }
                }
                jqScroller.unblock();
            },
            error : function() {
                $(".progress-loader a").show();
                $(".progress-loader .loading").css("display", "none");
                jqScroller.unblock();
            }
        });
    };
    jqScroller.run();
    jqScroller.render(1);
</script>
<script type="text/javascript">
    require(['base']);
</script>
</body>
</html>
